package com.wc.算法基础课.B第二讲数据结构.散列表.四平方和;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/3/21 14:58
 * @description https://www.acwing.com/problem/content/description/1223/
 */
public class Main {
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int M = 2300;
    static int N = 5000010;
    static int[] C = new int[N];
    static int[] D = new int[N];
    static int n;

    public static void main(String[] args) {
        n = sc.nextInt();
        Arrays.fill(C, -1);
        Arrays.fill(D, -1);
        for (int i = 0; i * i <= n; i++) {
            for (int j = i; i * i + j * j <= n; j++) {
                int s = i * i + j * j;
                if (C[s] == -1) {
                    C[s] = i;
                    D[s] = j;
                }
            }
        }
        for (int i = 0; i * i <= n; i++) {
            for (int j = i; i * i + j * j <= n; j++) {
                int s = n - i * i - j * j;
                if (C[s] != -1) {
                    System.out.println(i + " " + j + " " + C[s] + " " + D[s]);
                    return;
                }
            }
        }
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}
